const language: { [key: string]: any } = {}
const allLang = import.meta.glob('./**/*.ts', { eager: true, import: 'default' })

Object.entries(allLang).forEach(item => {
  const langMatch = item[0].match(/^\.\/.*\//g)?.[0]
  if (langMatch) {
    const lang = langMatch.replace(/\.|\//g, '')
    const key = item[0].replace(langMatch, '').replace(/\.ts$/, '')
    if (!language[lang]) language[lang] = {}
    language[lang][key] = item[1]
  }
})

export default language
